home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / zmdm_src.arc / ZMDM.H < prev    next >
C/C++ Source or Header  |  1988-06-26  |  4KB  |  147 lines

  1. /*
  2.  *     Common include file
  3.  *
  4.  *        Jwahar Bammi
  5.  *            usenet: mandrill!bammi@{decvax,sun}.UUCP
  6.  *            csnet:  bammi@mandrill.ces.CWRU.edu
  7.  *            arpa:   bammi@mandrill.ces.CWRU.edu
  8.  *            CompuServe: 71515,155
  9.  */
  10.  
  11. #include <stdio.h>
  12. #include <ctype.h>
  13. #include <setjmp.h>
  14. #include <osbind.h>
  15. #include "decl.h"
  16.  
  17.     /* See configurable parameters towards the end of the file */
  18.     /* Leave the rest alone                      */
  19.  
  20.  
  21.     
  22.      /* Common defines */
  23. #ifndef FALSE
  24. #define    FALSE         0
  25. #define TRUE         1
  26. #endif
  27.  
  28.  
  29. #define EscSeq(x)    Bconout(2,(int)'\033'); Bconout(2,(int)x) /* Send Esc.
  30.                             Seq. to     console */
  31. #define CTRL(X)        (X & 037) /* CTRL-anything */
  32.  
  33. #define STOS      "GEMDOS/TOS"
  34. #define ZMDMVERSION    "1.62 -- 05/19/88"
  35.  
  36. /* Ward Christensen / CP/M parameters - Don't change these! */
  37. #define ENQ 005
  38. #define CAN ('X'&037)
  39. #define XOFF ('s'&037)
  40. #define XON ('q'&037)
  41. #define SOH 1
  42. #define STX 2
  43. #define EOT 4
  44. #define ACK 6
  45. #define NAK 025
  46. #define CPMEOF 032
  47. #define WANTCRC 0103    /* send C not NAK to get crc not checksum */
  48. #define TIMEOUT (-2)
  49. #define RCDO (-3)
  50. #define ERRORMAX 5
  51. #define RETRYMAX 10    /* for dogs like compuserve */
  52. #define WCEOT (-10)
  53. #define SECSIZ 128    /* cp/m's Magic Number record size */
  54. #define PATHLEN 128    /* ready for 4.2 bsd ? noooooo */
  55. #define KSIZE 1024    /* record size with k option */
  56. #define UNIXFILE 0x8000    /* happens to the the S_IFREG file mask bit for stat */
  57. #define DEFBYTL 2000000000L    /* default rx file size */
  58. #define WANTG 0107    /* Send G not NAK to get nonstop batch xmsn */
  59.  
  60. #define PURGELINE    while(Bconstat(1))Bconin(1);Lleft = 0
  61.  
  62. #define Bauxws(X)     wr_modem(X)
  63.  
  64. #define RLOGFILE "rzlog"
  65. #define zperr vfile
  66. #define zperr2 vfile2
  67.  
  68. #define OK 0
  69.  
  70. #ifdef ERROR
  71. #undef ERROR
  72. #endif
  73. #define ERROR (-1)
  74.  
  75. #define HOWMANY 133
  76. /* Parameters for ZSINIT frame */
  77. #define ZATTNLEN 32    /* Max length of attention string */
  78.  
  79.      
  80.      /* Types */
  81.  
  82. #ifdef LONG
  83. #undef LONG    /* Get rid of stupid portab.h definition */
  84. #endif
  85.  
  86. #ifdef WORD
  87. #undef WORD
  88. #endif
  89.  
  90. #ifdef UWORD
  91. #undef UWORD
  92. #endif
  93.  
  94. struct    stat
  95. {
  96.     char    st_sp1[21];    /* Junk        */
  97.     char    st_mode;       /* File attributes */
  98.     int    st_time;       /* Mod Time      */
  99.     int     st_date;       /* Mod date      */
  100.     long    st_size;       /* File size       */
  101.     char    st_name[14];   /* File name       */
  102. };
  103.  
  104. /* The structure returned by Iorec(), really ptr to this type */
  105. typedef struct {
  106.     char *ibuf;
  107.     int ibufsiz;
  108.     int ibufhd;
  109.     int ibuftl;
  110.     int ibuflow;
  111.     int ibufhi;
  112. } IOREC;
  113.  
  114. typedef  struct {
  115.     char *sbaud;
  116.     int  ibaud;
  117.     int  jbaud;
  118. } BAUDS;
  119.  
  120. /*
  121.  * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell. 
  122.  *  NOTE: First srgument must be in range 0 to 255.
  123.  *        Second argument is referenced twice.
  124.  * 
  125.  * Programmers may incorporate any or all code into their programs, 
  126.  * giving proper credit within the source. Publication of the 
  127.  * source routines is permitted so long as proper credit is given 
  128.  * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, 
  129.  * Omen Technology.
  130.  */
  131. #ifndef IN_COMMON
  132. extern unsigned int crctab[]; /* see definition in common.c */
  133. extern unsigned long int crc_32_tab[]; /* see definition in common.c */
  134. #endif
  135.  
  136. #define updcrc(cp, crc) \
  137. ( crctab[(((unsigned int)crc >> 8) & 255)] ^ ((unsigned int)crc << 8) ^ (unsigned int)cp)
  138.  
  139. #define UPDC32(octet, crc) \
  140. (crc_32_tab[(((unsigned long)crc) ^ ((unsigned long)octet)) & 0xff] ^ (((unsigned long)crc) >> 8))
  141.  
  142.  
  143. #define BAUD_STRING(s)    ((s < 0) ? "**UNKNOWN**" : vbauds[s].sbaud)
  144. #define BAUD_RATE(s)    ((s < 0) ? 9600 : vbauds[s].jbaud)
  145.  
  146. /* -eof- */
  147.